/*
Navicat MySQL Data Transfer

Source Server         : Liferay
Source Server Version : 50539
Source Host           : localhost:3306
Source Database       : coreweb

Target Server Type    : MYSQL
Target Server Version : 50539
File Encoding         : 65001

Date: 2015-01-29 18:21:13
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `nlu_category`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_category`;
CREATE TABLE `nlu_category` (
`id`  bigint(20) NOT NULL AUTO_INCREMENT ,
`nameCategory`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=1

;

-- ----------------------------
-- Records of nlu_category
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for `nlu_class`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_class`;
CREATE TABLE `nlu_class` (
`idClass`  bigint(20) NOT NULL AUTO_INCREMENT ,
`nameOfClass`  char(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
`fkFaculty`  bigint(20) NULL DEFAULT NULL ,
PRIMARY KEY (`idClass`),
FOREIGN KEY (`fkFaculty`) REFERENCES `nlu_faculty` (`idFaculty`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `fkFaculty` (`fkFaculty`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
AUTO_INCREMENT=4

;

-- ----------------------------
-- Records of nlu_class
-- ----------------------------
BEGIN;
INSERT INTO `nlu_class` VALUES ('1', 'DH11DT', '1'), ('2', 'DH12DT', '1'), ('3', 'DH11KE', '2');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_contact`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_contact`;
CREATE TABLE `nlu_contact` (
`id`  bigint(20) NOT NULL AUTO_INCREMENT ,
`fullName`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`email`  char(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`phone`  char(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`title`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`question`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`dateCreate`  char(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`isRead`  tinyint(4) NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=5

;

-- ----------------------------
-- Records of nlu_contact
-- ----------------------------
BEGIN;
INSERT INTO `nlu_contact` VALUES ('3', 'Joe Bloggs', 'test@liferay.com', '', 'gj', 'jggggg', 'Tue Dec 23 14:53:47 GMT 2014', '1'), ('4', 'Joe Bloggs', 'test@liferay.com', '', 'ewqewq', 'sdsaf', 'Fri Dec 26 08:47:19 GMT 2014', '0');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_faculty`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_faculty`;
CREATE TABLE `nlu_faculty` (
`idFaculty`  bigint(20) NOT NULL AUTO_INCREMENT ,
`nameFaculty`  varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ,
`fkgroup`  tinyint(4) NULL DEFAULT NULL ,
PRIMARY KEY (`idFaculty`),
FOREIGN KEY (`fkgroup`) REFERENCES `nlu_group` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `group` (`fkgroup`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=4

;

-- ----------------------------
-- Records of nlu_faculty
-- ----------------------------
BEGIN;
INSERT INTO `nlu_faculty` VALUES ('1', 'Công Nghệ Thông Tin', '2'), ('2', 'Kinh Tế', '1'), ('3', 'Chăn Nuôi Thú Y', '2');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_group`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_group`;
CREATE TABLE `nlu_group` (
`id`  tinyint(4) NOT NULL AUTO_INCREMENT ,
`name`  varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
AUTO_INCREMENT=3

;

-- ----------------------------
-- Records of nlu_group
-- ----------------------------
BEGIN;
INSERT INTO `nlu_group` VALUES ('1', '1'), ('2', '2');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_lesson`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_lesson`;
CREATE TABLE `nlu_lesson` (
`idLesson`  tinyint(20) NOT NULL AUTO_INCREMENT ,
`rankOfLesson`  char(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ,
PRIMARY KEY (`idLesson`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci
AUTO_INCREMENT=6

;

-- ----------------------------
-- Records of nlu_lesson
-- ----------------------------
BEGIN;
INSERT INTO `nlu_lesson` VALUES ('1', '1-2-3'), ('2', '4-5-6'), ('3', '7-8-9'), ('4', '10-11-12'), ('5', '13-14-15');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_price`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_price`;
CREATE TABLE `nlu_price` (
`id`  tinyint(4) NOT NULL AUTO_INCREMENT ,
`idgroup`  tinyint(4) NULL DEFAULT NULL ,
`price`  double NULL DEFAULT NULL ,
PRIMARY KEY (`id`),
FOREIGN KEY (`idgroup`) REFERENCES `nlu_group` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT,
INDEX `idgroup` (`idgroup`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
AUTO_INCREMENT=3

;

-- ----------------------------
-- Records of nlu_price
-- ----------------------------
BEGIN;
INSERT INTO `nlu_price` VALUES ('1', '1', '160000'), ('2', '2', '193000');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_room`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_room`;
CREATE TABLE `nlu_room` (
`idRoom`  int(20) NOT NULL AUTO_INCREMENT ,
`nameRoom`  varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ,
PRIMARY KEY (`idRoom`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci
AUTO_INCREMENT=116

;

-- ----------------------------
-- Records of nlu_room
-- ----------------------------
BEGIN;
INSERT INTO `nlu_room` VALUES ('111', 'RD306'), ('112', 'RD406'), ('113', 'PV323'), ('114', 'PV325'), ('115', 'TV101');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_subject`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_subject`;
CREATE TABLE `nlu_subject` (
`idSubject`  bigint(20) NOT NULL AUTO_INCREMENT ,
`nameSubject`  varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ,
`numberOfCredit`  tinyint(11) NULL DEFAULT NULL ,
`fkFaculty`  bigint(20) NULL DEFAULT NULL ,
PRIMARY KEY (`idSubject`),
FOREIGN KEY (`fkFaculty`) REFERENCES `nlu_faculty` (`idFaculty`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `fkFaculty` (`fkFaculty`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci
AUTO_INCREMENT=11016

;

-- ----------------------------
-- Records of nlu_subject
-- ----------------------------
BEGIN;
INSERT INTO `nlu_subject` VALUES ('11011', 'Lập Trình Căn Bản', '3', '1'), ('11012', 'Công nghệ phần mềm', '4', '1'), ('11013', 'LT Web', '3', '1'), ('11014', 'Phong Thủy Ứng Dụng', '3', '2'), ('11015', 'Bệnh Động Vật', '4', '3');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_subjectdetail`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_subjectdetail`;
CREATE TABLE `nlu_subjectdetail` (
`id`  bigint(20) NOT NULL AUTO_INCREMENT ,
`fkSubjectOpen`  bigint(20) NOT NULL ,
`fkStudent`  bigint(20) NOT NULL ,
`mark`  double(20,0) NOT NULL ,
`numberOfStudy`  bigint(20) NOT NULL ,
PRIMARY KEY (`id`),
FOREIGN KEY (`fkStudent`) REFERENCES `user_` (`userId`) ON DELETE RESTRICT ON UPDATE RESTRICT,
FOREIGN KEY (`fkSubjectOpen`) REFERENCES `nlu_subjectopen` (`idSubjectOpen`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `idStudent` (`fkSubjectOpen`) USING BTREE ,
INDEX `idClass` (`fkStudent`) USING BTREE ,
INDEX `idRoom` (`mark`) USING BTREE ,
INDEX `idSchedule` (`numberOfStudy`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci
AUTO_INCREMENT=5

;

-- ----------------------------
-- Records of nlu_subjectdetail
-- ----------------------------
BEGIN;
INSERT INTO `nlu_subjectdetail` VALUES ('1', '1', '10760', '8', '1'), ('2', '2', '10760', '9', '1'), ('3', '3', '10437', '10', '1'), ('4', '4', '10760', '7', '1');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_subjectopen`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_subjectopen`;
CREATE TABLE `nlu_subjectopen` (
`idSubjectOpen`  bigint(20) NOT NULL AUTO_INCREMENT ,
`fkSubject`  bigint(20) NULL DEFAULT NULL ,
`fkTeacher`  bigint(20) NULL DEFAULT NULL ,
`fkRoom`  int(11) NULL DEFAULT NULL ,
`fkClass`  bigint(20) NULL DEFAULT NULL ,
`fkYearOfSemester`  bigint(20) NULL DEFAULT NULL ,
`fkLesson`  tinyint(4) NULL DEFAULT NULL ,
`date_start`  date NULL DEFAULT NULL ,
`date_end`  date NULL DEFAULT NULL ,
`weekdays`  varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
PRIMARY KEY (`idSubjectOpen`),
FOREIGN KEY (`fkSubject`) REFERENCES `nlu_subject` (`idSubject`) ON DELETE RESTRICT ON UPDATE RESTRICT,
FOREIGN KEY (`fkLesson`) REFERENCES `nlu_lesson` (`idLesson`) ON DELETE SET NULL ON UPDATE RESTRICT,
FOREIGN KEY (`fkClass`) REFERENCES `nlu_class` (`idClass`) ON DELETE SET NULL ON UPDATE RESTRICT,
FOREIGN KEY (`fkRoom`) REFERENCES `nlu_room` (`idRoom`) ON DELETE SET NULL ON UPDATE RESTRICT,
FOREIGN KEY (`fkYearOfSemester`) REFERENCES `nlu_yearofsemester` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
FOREIGN KEY (`fkTeacher`) REFERENCES `user_` (`userId`) ON DELETE SET NULL ON UPDATE RESTRICT,
INDEX `fkSubject` (`fkSubject`) USING BTREE ,
INDEX `fkClass` (`fkClass`) USING BTREE ,
INDEX `fkLesson` (`fkLesson`) USING BTREE ,
INDEX `fkRoom` (`fkRoom`) USING BTREE ,
INDEX `fkYearOfSemester` (`fkYearOfSemester`) USING BTREE ,
INDEX `nlu_subjectopen_ibfk_5` (`fkTeacher`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
AUTO_INCREMENT=5

;

-- ----------------------------
-- Records of nlu_subjectopen
-- ----------------------------
BEGIN;
INSERT INTO `nlu_subjectopen` VALUES ('1', '11015', '10161', '112', '2', '1', '1', '2014-02-14', '2014-10-12', '2'), ('2', '11014', '10201', '113', '1', '2', '2', '2014-02-14', '2015-05-10', '3'), ('3', '11011', '10760', '114', '1', '2', '2', '2014-05-10', '2015-10-10', '4'), ('4', '11012', '10437', '115', '3', '2', '4', '2014-06-10', '2015-02-10', '7');
COMMIT;

-- ----------------------------
-- Table structure for `nlu_yearofsemester`
-- ----------------------------
DROP TABLE IF EXISTS `nlu_yearofsemester`;
CREATE TABLE `nlu_yearofsemester` (
`id`  bigint(20) NOT NULL AUTO_INCREMENT ,
`semester`  tinyint(4) NULL DEFAULT NULL ,
`yearOfSemester`  varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
AUTO_INCREMENT=3

;

-- ----------------------------
-- Records of nlu_yearofsemester
-- ----------------------------
BEGIN;
INSERT INTO `nlu_yearofsemester` VALUES ('1', '1', '2014-2015'), ('2', '2', '2014-2015');
COMMIT;

-- ----------------------------
-- Table structure for `users_facultys`
-- ----------------------------
DROP TABLE IF EXISTS `users_facultys`;
CREATE TABLE `users_facultys` (
`userId`  bigint(20) NOT NULL DEFAULT 0 ,
`Idfaculty`  bigint(20) NOT NULL DEFAULT 0 ,
PRIMARY KEY (`userId`, `Idfaculty`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci

;

-- ----------------------------
-- Records of users_facultys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Auto increment value for `nlu_category`
-- ----------------------------
ALTER TABLE `nlu_category` AUTO_INCREMENT=1;

-- ----------------------------
-- Auto increment value for `nlu_class`
-- ----------------------------
ALTER TABLE `nlu_class` AUTO_INCREMENT=4;

-- ----------------------------
-- Auto increment value for `nlu_contact`
-- ----------------------------
ALTER TABLE `nlu_contact` AUTO_INCREMENT=5;

-- ----------------------------
-- Auto increment value for `nlu_faculty`
-- ----------------------------
ALTER TABLE `nlu_faculty` AUTO_INCREMENT=4;

-- ----------------------------
-- Auto increment value for `nlu_group`
-- ----------------------------
ALTER TABLE `nlu_group` AUTO_INCREMENT=3;

-- ----------------------------
-- Auto increment value for `nlu_lesson`
-- ----------------------------
ALTER TABLE `nlu_lesson` AUTO_INCREMENT=6;

-- ----------------------------
-- Auto increment value for `nlu_price`
-- ----------------------------
ALTER TABLE `nlu_price` AUTO_INCREMENT=3;

-- ----------------------------
-- Auto increment value for `nlu_room`
-- ----------------------------
ALTER TABLE `nlu_room` AUTO_INCREMENT=116;

-- ----------------------------
-- Auto increment value for `nlu_subject`
-- ----------------------------
ALTER TABLE `nlu_subject` AUTO_INCREMENT=11016;

-- ----------------------------
-- Auto increment value for `nlu_subjectdetail`
-- ----------------------------
ALTER TABLE `nlu_subjectdetail` AUTO_INCREMENT=5;

-- ----------------------------
-- Auto increment value for `nlu_subjectopen`
-- ----------------------------
ALTER TABLE `nlu_subjectopen` AUTO_INCREMENT=5;

-- ----------------------------
-- Auto increment value for `nlu_yearofsemester`
-- ----------------------------
ALTER TABLE `nlu_yearofsemester` AUTO_INCREMENT=3;
